<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('退回电话工单')"/>
    <link th:href="@{/ajax/libs/bootstrap-tagsinput/tagsinput.css}" rel="stylesheet">
    <link th:href="@{/ajax/libs/jQuery-ui/jquery-ui.css}" rel="stylesheet">

</head>

<body style="background-color: #F4F6FA">
<div class="main-content" style="margin: 0;padding: 0">

    <form id="form-user-add" th:object="${sendBackEty}" class="form-horizontal" style="background-color: #F4F6FA">
        <input type="hidden" th:field="*{wfId}"/>
        <input type="hidden" th:field="*{pkId}"/>
        <input type="hidden" th:field="*{sortCode}"/>
        <input type="hidden" th:field="*{sdeptName}"/>
        <input type="hidden" th:field="*{sdeptId}"/>
        <input type="hidden" th:field="*{isGoBack}"/>
        <input type="hidden" id="crtUserRole" th:value="${user.roles.get(0).roleId}"/>
        <input type="hidden" name="crtStepId" id="crtStepId" value="500"/>
        <input type="hidden" name="isGoBackToPeerDept" id="isGoBackToPeerDept" th:value="${isGoBackToPeerDept}"/>
        <input type="hidden" name="crtStepName" id="crtStepName" value="待区县部门处理"/>
        <div class="col-sm-12" style="display: flex" th:object="${workFormEty}">
            <!--     左       -->
            <div class="col-sm-6 entering-page">
                <!--   来电基本信息     -->
                <div class="col-sm-12 tltieBoder">
                    <div class="blueBorder"></div>
                    <h4 style="margin:0 0 0 10px">来电及通话信息</h4>
                </div>
                <!--事发地址-->
                <div class="col-sm-12 entering-mt">
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label is-required entering-pd">联系电话：</label>
                        <div class="col-sm-8">
                            <input name="fromTelA" th:field="*{fromTelA}" placeholder="请输入"
                                   class="form-control scene theAddress" type="text">
                        </div>
                    </div>
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label entering-pd">内容类别：</label>
                        <div class="col-sm-8">
                            <input id="qxCT" style="width:143px;height:31px;" th:value="*{dcntAname}">
                            <input id="txtDcntAcode" name="dcntAcode" type="hidden" th:value="*{dcntAcode}"/>
                            <input id="txtDCntAName" name="dcntAname" type="hidden" th:value="*{dcntAname}"/>
                        </div>
                    </div>

                </div>
                <!-- 来电类型,内容类别..-->
                <div class="col-sm-12">
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label  entering-pd">来电人：</label>
                        <div class="col-sm-8">
                            <input name="fromName" th:field="*{fromName}" placeholder="请输入"
                                   class="form-control scene " type="text">
                        </div>
                    </div>
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label entering-pd">来电类别：</label>
                        <div class="col-sm-8">
                            <select name="dfmClaNo" id="dfmClaNo"
                                    th:with="telTypes=${@commonServiceImpl.findTelType()}"
                                    onchange="dropChgSendTextOnly(this,'dfmClaName');"
                                    class="form-control formSelect">
                                <option value="">--请选择--</option>
                                <th:block th:each="item : ${telTypes}">
                                    <option th:text="${item['CSText']}" th:value="${item['CSValue']}"
                                            th:selected="${item['CSValue']} == *{dfmClaNo}"></option>
                                </th:block>
                            </select>
                            <input type="hidden" name="dfmClaName" id="dfmClaName" th:value="*{dfmClaName}"/>
                        </div>
                    </div>
                </div>
                <div class="col-sm-12 entering-mt">
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label entering-pd">地区：</label>
                        <div class="col-sm-8">
                            <select name="fmAreaNo" th:field="*{fmAreaNo}" id="fmAreaNo"
                                    onchange="dropChgSendTextOnly(this,'fmAreaName');"
                                    th:with="district=${@commonServiceImpl.findArea()}" class="form-control formSelect"
                                    required>
                                <option value="">--请选择--</option>
                                <option th:each="item : ${district}" th:text="${item['CSText']}"
                                        th:value="${item['CSValue']}"></option>
                            </select>
                            <input type="hidden" id="fmAreaName" name="fmAreaName" th:value="*{fmAreaName}"/>
                        </div>
                    </div>
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label entering-pd">地址：</label>
                        <div class="col-sm-8">
                            <input name="fmAddress" th:field="*{fmAddress}" placeholder="请输入"
                                   class="form-control scene " type="text">
                        </div>
                    </div>
                </div>
                <div class="col-sm-12">
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label entering-pd">流水号：</label>
                        <div class="col-sm-8">
                            <input id="wsCode" name="wsCode" th:field="*{wsCode}" placeholder="请输入"
                                   class="form-control serial"
                                   type="text"
                                   maxlength="11" required="" disabled>
                        </div>
                    </div>
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label entering-pd">提取码：</label>
                        <div class="col-sm-8">
                            <input name="wsKey" placeholder="请输入"
                                   class="form-control code"
                                   type="text" th:field="*{wsKey}"
                                   maxlength="11" required="" disabled>
                        </div>
                    </div>
                </div>
                <div class="col-sm-12" style="margin: 8px 0 8px 0;">
                    <div class="form-group">
                        <label class="col-xs-2 control-label entering-pd">通话内容：</label>
                        <div class="col-xs-10">
                            <!--呈批-->
                            <textarea name="fmContent" th:field="*{fmContent}" maxlength="3500"
                                      class="form-control workRemark"
                                      rows="3" style="width:406px;height: 100px"></textarea>
                        </div>
                    </div>
                </div>
            </div>
            <!--     右       -->
            <div class="col-sm-6 entering-page">
                <div class="col-sm-12">
                    <!--   工单基本信息     -->
                    <div class="col-sm-12 tltieBoder">
                        <div class="blueBorder"></div>
                        <h4 style="margin:0 0 0 10px">工单基本信息</h4>
                    </div>
                    <!--工单主题,工单编号,工单性质...-->
                    <div class="col-sm-12">
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label entering-pd">工单主题：</label>
                            <div class="col-sm-8">
                                <input name="wsTopic" th:field="*{wsTopic}" placeholder="请输入"
                                       class="form-control workTheme" type="text"
                                       required="">
                            </div>
                        </div>
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label is-required entering-pd">工单编号：</label>
                            <div class="col-sm-8">
                                <input name="workFormNo" th:field="*{workFormNo}" placeholder="请输入"
                                       class="form-control scene theAddress" type="text" disabled>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label  entering-pd">工单性质：</label>
                            <div class="col-sm-8">
                                <select name="setProId" id="setProId" onchange="getSetProName()"
                                        th:with="district=${@commonServiceImpl.findWorkFormType()}"
                                        class="form-control formSelect">
                                    <option value="">--请选择--</option>
                                    <option th:each="item : ${district}" th:text="${item['CSText']}"
                                            th:value="${item['CSValue']}"
                                            th:selected="${item['CSValue']} == *{setProId}"></option>
                                </select>
                                <input id="setProName" type="hidden" name="setProName" th:value="*{setProName}"/>
                            </div>
                        </div>
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label entering-pd">拟办时限：</label>
                            <div class="col-sm-8">
                                <input name="wfLimit" th:field="*{wfLimit}" placeholder="请输入"
                                       class="form-control code"
                                       type="text">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label entering-pd">建议公开：</label>
                            <div class="col-xs-8">
                                <label class="check-box">
                                    <input name="openX" th:checked="*{openX == 1}" value="1" type="radio">是
                                </label>
                                <label class="check-box">
                                    <input name="openX" th:checked="*{openX == 0}" value="0" type="radio">否
                                </label>
                            </div>
                        </div>
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label entering-pd">摘报：</label>
                            <div class="col-xs-8">
                                <label class="check-box">
                                    <input name="reportFlag" th:checked="*{reportFlag == 1}" value="1" type="radio">是
                                </label>
                                <label class="check-box">
                                    <input name="reportFlag" th:checked="*{reportFlag == 0}" value="0" type="radio">否
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label entering-pd">创建人：</label>
                            <div class="col-sm-8">
                                <input name="iptWorker" th:field="*{iptWorker}" placeholder="请输入"
                                       class="form-control code"
                                       type="text" disabled>
                            </div>
                        </div>
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label entering-pd">创建时间：</label>
                            <div class="col-sm-8">
                                <input name="iptTime" th:field="*{iptTime}" placeholder="请输入"
                                       class="form-control code"
                                       type="text" disabled>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-12" style="display: flex">
            <div class="col-sm-12 entering-page">
                <!--    延期申请    -->
                <div class="col-sm-12 tltieBoder">
                    <div class="blueBorder"></div>
                    <h4 style="margin:0 0 0 10px;color: red">处理方式：退回</h4>
                </div>
                <div class="col-sm-12">
                    <label class="col-sm-2 control-label is-required entering-pd">退回理由及建议：</label>
                    <div class="col-sm-8">
                        <textarea name="backRemark" th:text="${sendBackEty.backRemark}" maxlength="1000"
                                  class="form-control"
                                  cols="60"
                                  rows="3" required></textarea>
                    </div>
                </div>
                <!--按钮-->
                <div class="col-sm-12" style="display: flex;justify-content: space-around;margin-bottom: 10px;margin-top: 10px">
                    <div class="col-sm-4" style="display: flex;justify-content: space-evenly;">
                        <button type="button" class="btn btn-sm btn-success" onclick="backTo()">退回</button>
                        <button type="button" class="btn btn-sm btn-light" onclick="closeItem()">关闭</button>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<script th:src="@{/ajax/libs/layui/laydate.js}"></script>
<th:block th:include="include :: footer"/>
<script th:src="@{/ajax/libs/bootstrap-tagsinput/tagsinput.min.js}"></script>
<script th:src="@{/ajax/libs/jQuery-ui/jquery-ui.js}"></script>
<script th:src="@{/js/extension.js}"></script>

<script>
    var prefix = ctx + "system/mTelWF";
    function backTo(){
        if ($('#isGoBackToPeerDept').val() == 1){
            $.modal.alertWarning("当前部门无退回权限！");
            return false;
        }
        if ($("#isGoBack").val() == 1){
            $.modal.alertWarning("此工单不允许退回");
            return false;
        }
        const sortCode = $('#sortCode').val();
        const crtRole = $("#crtRole").val();
        const stepRoles = "210,240,260,290,310,340";
        if(stepRoles.indexOf(crtRole) > -1){//市级
            if ("11" !== sortCode) {
                $('#backState').val(12);
                $("#crtStepId").val("400");
                $("#crtStepName").val("市级协办退回");
            }else{
                    $('#backState').val(11);
                    $("#crtStepId").val("401");
                    $("#crtStepName").val("市级主办退回");
            }
        }
        else{//11 普通工单
            if ("11" !== sortCode) {
                $('#backState').val(12);
                $("#crtStepId").val("400");
                $("#crtStepName").val("区（市）县协办退回");
            }else{
                $('#backState').val(11);
                $("#crtStepId").val("401");
                $("#crtStepName").val("区（市）县主办退回");
            }
        }

        if ($.validate.form()) {
            let url = prefix + "/cmnFile/dlBackS";
            let data = $('#form-user-add').serializeArray();
            $.operate.saveTab(url,data);
        }
    }


</script>
</body>
</html>

